import json

import scrapy


class DoubanSpider(scrapy.Spider):
    name = "douban"
    allowed_domains = ["douban.com"]
    start_urls = ["https://douban.com"]

    def start_request(self, response):
        url = 'https://movie.douban.com/top250'
        data = {
            "start": 25,
            "filter": ''
        }
        yield scrapy.Request(url, body=json.dumps(data), callbacks=self.parse)

    def parse(self, response):
        print(response.text)
